<?php
/*
 * Smarty plugin
 * *feito pelo werneck
 * -------------------------------------------------------------
 * File:     function.css.php
 * Type:     function
 * Name:     css
 * Purpose:  css helper
 * -------------------------------------------------------------
 */
function smarty_function_css($params, &$view)
{
	if (!empty($params['file'])) {
	
		$filename = $params['file'];
				
		$path = WEB_ROOT . "css/" . $filename;

		if (!file_exists(APP_ROOT . "css" . DS . $filename)) 
		{
			trigger_error("assign: invalid 'file' parameter: uneable to locate $path");
			return;
		}
	} 
	else if (!empty($params['url'])) {
		$path = $params['url'];
	}
	else {
		trigger_error("assign: missing 'file' or 'url' parameter");
		return;
	}
	
	return '<link rel="stylesheet" type="text/css" href="'.$path.'" />';
}
?>